<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05流程控制</title>
</head>
<body>

<script>
    //1.顺序结构
    console.log(1);
    console.log(2);
    console.log(3);

    //2.分支结构
    let username = '';
    if (!username){// 若用户名为空字符串，转为布尔是false，!false为true，走分支1
        alert('用户名不能为空！')
    }else {
        alert('欢迎'+username+'回归')
    }

    // 循环结构
    let names = ['张三','李四','王五'];
    for (let i = 0; i <names.length; i++) {
        console.log(names[i])
    }
    // console.log(i)

    for (let n of names) {
        console.log(n)
    }

</script>

</body>
</html>